
from PyQt4.QtCore import QObject, SIGNAL, QString

class SCIOHandler(object):
    """Handle stream output"""
    def __init__(self, mode,
                 write_func=None, read_func=None, flush_func=None):
        self.mode = mode
        self.closed = False
        self.encoding = 'utf-8'
        self._write = write_func
        self._read = read_func
        self._flush = flush_func
    def write(self, cmd):
        self._write(cmd)
    def writelines(self, textlist):
        map(self.write, textlist)
    def flush(self):
        self._flush()
    def fileno(self):
        return 0
    def isatty(self):
        return False
    def readline(self, sizehint=-1):
        return self._read()

class SCOutputHandler(QObject):
    ''''''
    def __init__(self,parent=None):
        QObject.__init__(self,parent)
        
    def write(self,value):
        self.emit(SIGNAL('printOut(QString)'),QString(value))

    def flush(self):
        pass
